﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="HightLoadTests.cs" company="dimamartovoi">
//   Apache License
//   Version 2.0, January 2004
//   http://www.apache.org/licenses
// </copyright>
// <summary>
//   The hight load tests.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

using System.Diagnostics;
using System.IO;
using System.Reflection;

using ActorModel.Infrastructure;
using ActorModel.Infrastructure.Configuration.XML;

using Common.Logging;

using NUnit.Framework;

namespace HighLoadTests
{
    /// <summary>
    /// The hight load tests.
    /// </summary>
    [TestFixture]
    public class HightLoadTests
    {
        #region Public Methods and Operators

        /// <summary>
        /// The emulate graph.
        /// </summary>
        [Test]
        [Ignore("Incomplite yet.")]
        public void EmulateGraph()
        {
            string codePath = Path.Combine(TestContext.CurrentContext.WorkDirectory, @"EvolutionStateFuncs\life2.evol");
            string code = File.ReadAllText(codePath);

            var loader = new XMLEngineLoader();
            EngineStartParameters<string> parameters = loader.Load(code);
            var engineBootstrapper = new EngineBootstrapper<string>(parameters);
            IEngineFlowController<string> flowController = engineBootstrapper.Initialize();

            ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

            var stopwatch = new Stopwatch();
            stopwatch.Start();

            log.Debug(flowController.ToString());

            log.Debug("------------evolution--------------");
            flowController.Evolute();
            log.Debug(flowController.ToString());

            log.Debug("------------evolution--------------");
            flowController.Evolute();
            log.Debug(flowController.ToString());

            log.Debug("------------evolution--------------");
            flowController.Evolute();
            log.Debug(flowController.ToString());

            log.Debug("------------evolution--------------");
            flowController.Evolute();
            log.Debug(flowController.ToString());

            stopwatch.Stop();
            log.Debug(stopwatch.Elapsed);
        }

        #endregion
    }
}